cmake_minimum_required(VERSION 3.22)
project(Dataset_maker)

set(CMAKE_CXX_STANDARD 17)

find_package(Eigen3 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(jsoncpp REQUIRED)

function(include_sub_dir root_dir)
    if (IS_DIRECTORY ${root_dir})
        # message("include dir: " ${root_dir})
        include_directories(${root_dir})
    endif()
    file(GLOB ALL_SUB RELATIVE ${root_dir} ${root_dir}/*)
    foreach(sub ${ALL_SUB})
        if (IS_DIRECTORY ${root_dir}/${sub})
            include_sub_dir(${root_dir}/${sub})
        endif()
    endforeach()
endfunction()
#调用递归函数链接自己的头文件
include_sub_dir(${CMAKE_SOURCE_DIR}/src)

file(GLOB_RECURSE DIR_SRCS "src/*.cpp")
add_executable(${PROJECT_NAME} main.cpp ${DIR_SRCS})
target_link_libraries(${PROJECT_NAME} PRIVATE Eigen3::Eigen ${OpenCV_LIBS} libjsoncpp.a)
